import styled from 'styled-components'
import Icon from '@/components/Icon'
export const IconRemove = styled(Icon)`
	width: 14px;
	height: 14px;
	background-position: -77px -245px;
`
/**哑音白色*/
export const IconCancelMuteHoverAndChecked = styled(Icon)`
	width: 20px;
	height: 19px;
	background-position: -48px -1100px;
`
/**哑音*/
export const IconCancelMute = styled(Icon)`
	width: 20px;
	height: 19px;
	background-position: -70px -1100px;
`
/**哑音白色*/
export const IconMuteHoverAndChecked = styled(Icon)`
	width: 20px;
	height: 19px;
	background-position: 0px -1100px;
`
export interface WrapProps {
	readonly checked: boolean
	readonly indexWidth?: number
	readonly flag?: Boolean
}
export const Wrap = styled.div.attrs((props: WrapProps) => ({
	className: props.checked ? 'checked' : '',
}))<WrapProps>`
	height: 30px;
	line-height: 30px;
	margin: 2px 0px 0px 0px;
	user-select: none;
	cursor: pointer;
	position: relative;
	.cancelMute {
		.hover {
			display: none;
		}
		.no_hover {
			display: block;
			right: 10px;
			position: absolute;
			top: 5px;
		}
	}
	&:hover {
		color: #ffffff;
		background: linear-gradient(90deg, #2d8bc0, #53afe4);
		.icon-checkbox {
			background-position: -237px -1672px;
		}
		.cancelMute {
			position: absolute;
			right: 30px;
			top: 50%;
			margin-top: -11px;
			.hover {
				display: block !important;
			}
			.no_hover {
				display: none;
			}
		}
		.mute {
			position: absolute;
			right: 30px;
			top: 50%;
			margin-top: -11px;
		}
		.name {
			width: ${(props) => `calc(100% - 26px - ${props.indexWidth}px - 6px - 24px - 10px - 25px - 18px)`};
		}
	}
	&.checked,
	&.checked:hover {
		color: ${(props) => {
			return props.flag ? '#2bb7ff' : '#fff'
		}};
		background: linear-gradient(90deg, #2d8bc0, #53afe4);
		.icon-checkbox {
			background-position: -93px -1672px;
		}
		.cancelMute {
			position: absolute;
			right: 30px;
			top: 50%;
			margin-top: -11px;
			.hover {
				display: block !important;
			}
			.no_hover {
				display: none;
			}
		}
		.mute {
			position: absolute;
			right: 30px;
			top: 50%;
			margin-top: -11px;
		}
		.name {
			width: ${(props) => `calc(100% - 26px - ${props.indexWidth}px - 6px - 24px - 10px - 25px - 18px)`};
		}
	}
	> div {
		float: left;
	}
	.checkbox-wrap {
		width: 26px;
		height: 30px;
		text-align: center;
		padding-top: 1px;
		box-sizing: border-box;
	}
	.item-index {
		width: ${(props) => props.indexWidth + 'px'};
		margin-right: 6px;
	}
	.avatar {
		margin-right: 10px;
		height: 30px;
		line-height: 30px;
		padding-top: 3px;
		box-sizing: border-box;
	}
	.name {
		display: flex;
		align-items: center;
		width: ${(props) => `calc(100% - 26px - ${props.indexWidth}px - 6px - 24px - 10px - 25px)`};
		.poll_item_name {
			display: inline-block;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	}
	.poll_item_position {
		display: inline-block;
		margin-right: 8px;
	}
	.remove {
		position: absolute;
		right: 12px;
		top: 50%;
		margin-top: -11px;
	}
`
